<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Bootstrap4下拉框功能强化插件|DEMO_jQuery之家-自由分享jQuery、html5、css3的插件库</title>
	<link href="https://cdn.bootcss.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet">
	<!-- <link rel="stylesheet" type="text/css" href="css/htmleaf-demo.css"> --><!--演示页面样式，使用时可以不引用-->
	<link href="css/component-chosen.css" rel="stylesheet">
</head>
<body class="h-100">
	<div class="htmleaf-container">
		<header class="htmleaf-header">
			<h1>Bootstrap4下拉框功能强化插件 <span>A selection of lightweight Bootstrap 4 UI components</span></h1>
			<div class="htmleaf-links">
				<a class="htmleaf-icon icon-htmleaf-home-outline" href="http://www.htmleaf.com/" title="jQuery之家" target="_blank"><span> jQuery之家</span></a>
				<a class="htmleaf-icon icon-htmleaf-arrow-forward-outline" href="http://www.htmleaf.com/jQuery/Form/201804145074.html" title="返回下载页" target="_blank"><span> 返回下载页</span></a>
			</div>
		</header>
		<div class="container h-100">
		    <div class="d-flex align-items-start flex-column h-100">
		      <form class="was-validated">
		        <div class="w-100 m-auto py-5">
		          <div class="row">
		            <div class="col-xs-12 col-md-4 mb-5">
		              <label>Single:</label>
		              <select id="single" class="form-control form-control-chosen" data-placeholder="Please select...">
		                <option></option>
		                <option>Option One</option>
		                <option>Option Two</option>
		                <option>Option Three</option>
		                <option>Option Four</option>
		                <option>Option Five</option>
		                <option>Option Six</option>
		                <option>Option Seven</option>
		                <option>Option Eight</option>
		              </select>
		            </div>
		            <div class="col-xs-12 col-md-4 mb-5">
		              <label>Single (required):</label>
		              <select id="required" class="form-control form-control-chosen-required" data-placeholder="Please select...">
		                <option></option>
		                <option>Option One</option>
		                <option>Option Two</option>
		                <option>Option Three</option>
		                <option>Option Four</option>
		                <option>Option Five</option>
		                <option>Option Six</option>
		                <option>Option Seven</option>
		                <option>Option Eight</option>
		              </select>
		            </div>
		            <div class="col-xs-12 col-md-4 mb-5">
		              <label>Multiple:</label>
		              <select id="multiple" class="form-control form-control-chosen" data-placeholder="Please select..." multiple>
		                <option></option>
		                <option>Option One</option>
		                <option>Option Two</option>
		                <option>Option Three</option>
		                <option>Option Four</option>
		                <option>Option Five</option>
		                <option>Option Six</option>
		                <option>Option Seven</option>
		                <option>Option Eight</option>
		              </select>
		            </div>
		            <div class="col-xs-12 col-md-4 mb-5">
		              <label>Optgroup:</label>
		              <select id="optgroup" class="form-control form-control-chosen" data-placeholder="Please select..." multiple>
		                <optgroup label="Label A">
		                  <option>Option One</option>
		                  <option>Option Two</option>
		                  <option>Option Three</option>
		                  <option>Option Four</option>
		                </optgroup>
		                <optgroup label="Label B">
		                  <option>Option Five</option>
		                  <option>Option Six</option>
		                  <option>Option Seven</option>
		                  <option>Option Eight</option>
		                </optgroup>
		              </select>
		            </div>
		            <div class="col-xs-12 col-md-4 mb-5">
		              <label>Clickable optgroup:</label>
		              <select id="optgroup_clickable" class="form-control form-control-chosen-optgroup" title="clickable_optgroup" data-placeholder="Please select..." multiple>
		                <optgroup label="Label A">
		                  <option>Option One</option>
		                  <option>Option Two</option>
		                  <option>Option Three</option>
		                  <option>Option Four</option>
		                </optgroup>
		                <optgroup label="Label B">
		                  <option>Option Five</option>
		                  <option>Option Six</option>
		                  <option>Option Seven</option>
		                  <option>Option Eight</option>
		                </optgroup>
		              </select>
		            </div>
		          </div>
		        </div>
		      </form>
		    </div>
		  </div>
		<div class="related">
		    <h3>如果你喜欢这个插件，那么你可能也喜欢:</h3>
		    <a href="http://www.htmleaf.com/jQuery/Form/201804115068.htmll">
			  <img src="related/1.jpg" width="300" alt="Bootstrap多级下拉菜单插件"/>
			  <h3>Bootstrap多级下拉菜单插件</h3>
			</a>
			<a href="http://www.htmleaf.com/jQuery/Form/201801134929.html">
			  <img src="related/2.jpg" width="300" alt="Bootstrap 4 select下拉框功能扩展和美化jquery插件"/>
			  <h3>Bootstrap 4 select下拉框功能扩展和美化jquery插件</h3>
			</a>
		</div>
	</div>
	
	<script src="http://cdn.bootcss.com/jquery/1.11.0/jquery.min.js" type="text/javascript"></script>
	<script>window.jQuery || document.write('<script src="js/jquery-1.11.0.min.js"><\/script>')</script>
	<script src="https://cdn.bootcss.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
	<script src="js/chosen.jquery.js"></script>
	<script type="text/javascript">
		$('.form-control-chosen').chosen({
		  allow_single_deselect: true,
		  width: '100%'
		});
		$('.form-control-chosen-required').chosen({
		  allow_single_deselect: false,
		  width: '100%'
		});
		$('.form-control-chosen-search-threshold-100').chosen({
		  allow_single_deselect: true,
		  disable_search_threshold: 100,
		  width: '100%'
		});
		$('.form-control-chosen-optgroup').chosen({
		  width: '100%'
		});

		$(function() {
		  $('[title="clickable_optgroup"]').addClass('chosen-container-optgroup-clickable');
		});
		$(document).on('click', '[title="clickable_optgroup"] .group-result', function() {
		  var unselected = $(this).nextUntil('.group-result').not('.result-selected');
		  if(unselected.length) {
		    unselected.trigger('mouseup');
		  } else {
		    $(this).nextUntil('.group-result').each(function() {
		      $('a.search-choice-close[data-option-array-index="' + $(this).data('option-array-index') + '"]').trigger('click');
		    });
		  }
		});
	</script>
</body>
</html>